﻿using System;
using System.Collections.Generic;
using System.Text;

namespace LeafHttp
{
    /// <summary>
    /// 请求参数
    /// </summary>
    public class RequestConfig
    {
        /// <summary>
        /// 请求地址
        /// </summary>
        public string Url { get; set; }
        /// <summary>
        /// 请求方法
        /// </summary>
        public string Method { get; set; }
        /// <summary>
        /// 请求的Url参数
        /// </summary>
        public Dictionary<string, object> Params { get; set; }
        /// <summary>
        /// 请求头内容
        /// </summary>
        public Dictionary<string, string> Headers { get; set; }
        /// <summary>
        /// 请求的Cookie
        /// </summary>
        public List<HttpCookie> Cookies { get; set; }
        /// <summary>
        /// 请求发送的数据（当Method为Put、Post、Patch时）
        /// 如果Data为Dictionary<string, object>，则请求头的Content-Type自动设置为application/x-www-form-urlencoded
        /// </summary>
        public object Data { get; set; }
        /// <summary>
        /// 请求超时的毫秒数
        /// </summary>
        public int Timeout { get; set; }
        /// <summary>
        /// 响应数据类型
        /// </summary>
        public ResponseDataType ResponseDataType { get; set; }
        /// <summary>
        /// 用于文件上传，Content-Type自动设为multipart/form-data
        /// </summary>
        public bool UseMultipartFormDataPost { get; set; }

        /// <summary>
        /// 构造函数
        /// </summary>
        public RequestConfig()
        {
            this.ResponseDataType = ResponseDataType.Text;
        }
    }
}
